import axios from '@/utils/axios'

export const getCelebrity = (id: string): Promise<ApiResult<LiteratureCelebrityPO>> => {
  return axios.get(`literature/celebrity/${id}`)
}

export const getCelebrityPage = (
  pagination: Pagination,
  params: LiteratureCelebrityPO
): Promise<ApiResult<Page<LiteratureCelebrityVO>>> => {
  return axios.get(`literature/celebrity/page/${pagination.page}/${pagination.pageSize}`, {
    params
  })
}

export const postOrPutCelebrity = (data: LiteratureCelebrityPO): Promise<ApiResult<null>> => {
  return axios.post(`literature/celebrity`, data)
}

export const deleteCelebrity = (id: string): Promise<ApiResult<null>> => {
  return axios.delete(`literature/celebrity/${id}`)
}

export const getCelebrityListByName = (
  name: string
): Promise<ApiResult<LiteratureCelebrityPO[]>> => {
  return axios.get(`literature/celebrity/list`, { params: { name } })
}
